package com.five.second_shop.service;

import com.five.second_shop.entity.Address;
import com.five.second_shop.mapper.AddressMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressService {
    @Autowired
    private AddressMapper addressMapper;

    /**
     * 查询地址
     * @param address
     * @return
     */
   public List<Address> queryAddress (Address address){
        return addressMapper.queryAddress(address);
    };

    /**
     * 更新地址信息
     * @param address
     * @return
     */
    public Integer updateAddress(Address address){
        return addressMapper.updateAddress(address);
    };

    /**
     * 新增地址
     * @param address
     * @return
     */
    public Integer insertAddress(Address address){
        return addressMapper.insertAddress(address);
    };

    /**
     * 根据id删除
     * @param id
     * @return
     */
    public Integer delById(@Param("id") String id){
        return addressMapper.delById(id);
    };

    /**
     * 去除默认状态
     * @param ids
     * @return
     */
    public Integer removeDefaultAdd (@Param(value = "ids") List ids){
      return addressMapper.removeDefaultAdd(ids);
    };
}
